Skip to content

fix: track late signal reads across framework adapters - #2135

Merged
clauderic merged 3 commits into
clauderic:mainfrom
kimjunha1231:codex/fix-react-late-signal-subscriptions
Sep 12, 2026
Merged

clauderic merged 3 commits into
clauderic:mainfrom
kimjunha1231:codex/fix-react-late-signal-subscriptions

Conversation

@kimjunha1231

@kimjunha1231 kimjunha1231 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A component can start reading draggable, droppable, or sortable state after its initial render—for example, after enabling a setting that displays isDragSource. React, Vue, Solid, and Svelte recorded the newly accessed property but could miss subsequent updates because the signal effect had not subscribed to it.

Getters that return a new object on every read, such as independently configured sortable.disabled flags, also expose update loops when subscriptions or notification counters feed back into rendering.

Change

  • Keep a tracker for each target and retain the signal effect across view updates.
  • Refresh the effect's dependencies when new properties are recorded: after a React commit, or in a deferred refresh for Vue, Solid, and Svelte.
  • Preserve the observer's comparison values across proxy reads so reads inside a signal batch cannot hide pending updates.
  • Dispose subscriptions when targets change or components unmount, including pending refreshes.
  • Keep framework notifications out of the dependencies being observed. In Svelte, the effect no longer reads its own notification counter.
  • Preserve React's synchronous-update behavior and Strict Mode cleanup.
  • Add a conditional-state Storybook example, pointer/keyboard regressions, React hook tests, and a shared adapter regression suite run separately in Vue, Solid, and Svelte.
  • Extend the patch changeset to all four framework packages.

To try the original scenario, open react-sortable--conditional-state, enable Show drag state, and drag Item 1. Its status should change from Idle to Dragging and back.

Validation

Tested locally with Node 22.16.0, Bun 1.3.11, and the locked dependencies.

  • Clean build: all 16 tasks passed.
  • Unit tests: all 150 passed.
  • Chromium browser suites, with retries disabled and two workers per suite: React 70, Vue 26, Solid 26, and Svelte 26 passed (148 total).
  • Targeted TypeScript checks, Prettier checks for changed TypeScript/Markdown files, and git diff --check passed.
  • Negative controls: the original Vue, Solid, and Svelte adapters fail the new late-read tests; the original Svelte adapter also reproduces effect_update_depth_exceeded for a fresh-object getter. The original React PR implementation reproduces its render loop in both normal and Strict Mode tests.

ESLint cannot start with the locked dependency tree: TypeError: Cannot set properties of undefined (setting 'defaultMeta') in @eslint/eslintrc/Ajv, before inspecting source files.

AI assistance: Prepared and updated with OpenAI Codex; the listed builds and tests were run locally.

@changeset-bot

changeset-bot Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 07447db

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@dnd-kit/react Patch
@dnd-kit/vue Patch
@dnd-kit/solid Patch
@dnd-kit/svelte Patch
@dnd-kit/abstract Patch
@dnd-kit/collision Patch
@dnd-kit/dom Patch
@dnd-kit/geometry Patch
@dnd-kit/helpers Patch
@dnd-kit/state Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Publish newly tracked properties after commit while retaining one signal effect per target. Preserve observer baselines across proxy reads and handle target replacement, synchronous updates, and Strict Mode cleanup.

Add browser regression coverage for late reads, object-valued getters, subscription stability, batching, and lifecycle behavior.
@pkg-pr-new

pkg-pr-new Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@dnd-kit/abstract

npm i https://pkg.pr.new/@dnd-kit/abstract@2135

@dnd-kit/collision

npm i https://pkg.pr.new/@dnd-kit/collision@2135

@dnd-kit/dom

npm i https://pkg.pr.new/@dnd-kit/dom@2135

@dnd-kit/geometry

npm i https://pkg.pr.new/@dnd-kit/geometry@2135

@dnd-kit/helpers

npm i https://pkg.pr.new/@dnd-kit/helpers@2135

@dnd-kit/react

npm i https://pkg.pr.new/@dnd-kit/react@2135

@dnd-kit/solid

npm i https://pkg.pr.new/@dnd-kit/solid@2135

@dnd-kit/state

npm i https://pkg.pr.new/@dnd-kit/state@2135

@dnd-kit/svelte

npm i https://pkg.pr.new/@dnd-kit/svelte@2135

@dnd-kit/vue

npm i https://pkg.pr.new/@dnd-kit/vue@2135

commit: 07447db

@clauderic clauderic changed the title fix(react): subscribe to signal properties read on later renders fix: track late signal reads across framework adapters Sep 12, 2026
@clauderic
clauderic merged commit e522d9c into clauderic:main Sep 12, 2026
8 of 9 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants